InstallShield 2018 » InstallScript Language Reference
Project • This information applies to the following project types:
• | InstallScript |
• | InstallScript MSI |
/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the functions SdProductName, SdWelcome,
* SdStartCopy2, and SdFinish.
*
* First, SdProductName is called to set the product name to
* substitute for the %P place holder, which is embedded in the
* message strings passed to SdWelcome and SdFinish.
*
* Next, SdWelcome is called to display a welcome message and
* then SdStartCopy2 is called. Finally, a call to SdFinish
* completes the setup process by giving the user final options.
*
* Note: Before running this script, set the preprocessor
* constants so that they reference the fully-qualified
* names of the Windows Notepad executable and a valid
* text file on the target system.
*
\*--------------------------------------------------------------*/
//Assign the name of a text file to READMEFILE
#define NOTEPAD "C:\\Windows\\Notepad.exe"
#define READMEFILE ""
STRING szProductName, szTitle, szMsg, szFeatures;
STRING szMsg1, szMsg2, szOpt1, szOpt2;
BOOL bvOpt1, bvOpt2;
NUMBER nReturn;
#include "ifx.h"
function OnBegin()
begin
// Set the product name to substitute for the %P place holder.
szProductName = "My Application";
SdProductName (szProductName);
SdWelcomeLabel:
szTitle = "SdWelcome Example";
// Disable the Back button in setup dialogs.
Disable (BACKBUTTON);
// Display the SdWelcome dialog. The null string in parameter
// two specifies the default message, which uses the %P place holder.
SdWelcome (szTitle, "");
// Enable the Back button in setup dialogs.
Enable (BACKBUTTON);
SdStartCopy2Label:
szTitle = "SdStartCopy2 Example";
// Display the SdStartCopy2 dialog.
if (SdStartCopy2 (szTitle, szMsg) = BACK) then
goto SdWelcomeLabel;
endif;
// The %P place holder is embedded in several of the string
// parameters that will be passed to SdFinish.
szTitle = "SdFinish Example";
szMsg1 = "%P Setup is almost complete.\n" +
"Choose the options you want below.";
szMsg2 = "Click Finish to complete %P Setup.";
szOpt1 = "I would like to view the README file.";
szOpt2 = "I would like to launch %P.";
// Display the SdFinish dialog.
SdFinish (szTitle, szMsg1, szMsg2, szOpt1, szOpt2, bvOpt1, bvOpt2);
if (bvOpt1) then
// Display the read me file.
LaunchAppAndWait (NOTEPAD, READMEFILE, LAAW_OPTION_WAIT);
endif;
if (bvOpt2) then
// Because this example does not actually install an
// application, a message box is displayed in place of
// the call to LaunchApp that would normally be made here,
// for example:
// LaunchApp (TARGETDIR^PROGRAMEXECUTABLE,"");
SprintfBox (INFORMATION, szTitle, "Launch %s here.", szProductName);
endif;
end;
InstallShield 2018 Help LibrarySeptember 2018 |
Copyright Information | Flexera |